<?php
/**
 *	template  default company magazine news picture photo
 * @author yxy
 *
 */

class MY_Controller extends CI_Controller{

    //记录不要验证SID的func
	public $NO_CHECK_SID_FUNC = null;

    public function __construct(){
        parent::__construct();
    }

    public function getUid(){
    	return get_cookie('TT-UID');
    }

    public function getGid(){
    	return get_cookie('TT-GID');
    }

    public function getSid(){
    	return get_cookie('TT-SID');
    }

    public function _show_error($error, $code = '0'){
        if($this->input->is_ajax_request()){
            $this->output->set_content_type('application/json')->set_output(json_encode(array(
                'code' => $code,
                'error' => $error,
            )));
        }else{
            show_error($error, 500,'错误：');
        }
    }

    public function _show_msg($code, $opts = array()){
        if($this->input->is_ajax_request()){
            $code = array_merge(array('code'=>$code), $opts);
            $this->output->set_content_type('application/json')->set_output(json_encode($code));
        }else{
            $code = array_merge(array('code'=>$code), $opts);
            $this->output->set_content_type('application/json')->set_output(json_encode($code));
        }
    }    
  
}
